home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DDJMAG / DDJ9005.ZIP / BOTTORFF.LST < prev    next >
File List  |  1990-03-23  |  1KB  |  63 lines

  1. _OBJECT SWAPPING_
  2. by Jan Bottorff and Jim Bolland
  3.  
  4. [Examplσ 1║ Objec⌠ access]
  5.  
  6. Se⌠ thσ object'≤ toucheΣ bit
  7. iµ objec⌠ no⌠ iε memory
  8. then
  9.    Swa≡ objec⌠ in
  10.    Updatσ O╘ entry
  11. endif
  12. Ge⌠ thσ object'≤ address
  13.  
  14.  
  15. [Examplσ 2║ Thσ aginτ process]
  16.  
  17. fo≥ "ß fewó O╘ entries
  18.    iµ objec⌠ i≤ touched
  19.    then
  20.      Se⌠ object'≤ agσ t∩ 0
  21.    else
  22.      iµ object'≤ agσ i≤ to∩ old
  23.      then
  24.        iµ objec⌠ i≤ dirty
  25.        then
  26.           writσ objec⌠ t∩ disk
  27.        endif
  28.        Se⌠ objec⌠ addres≤ iε O╘ to
  29.          disδ address
  30.        Marδ objec⌠ memor∙ as
  31.         "discarded"
  32.        else
  33.          Incremen⌠ object'≤ age
  34.       endif
  35.     endif
  36. endfor
  37.  
  38.  
  39. [Examplσ 3║ Pseud∩ codσ fo≥ swa≡ areß compaction]
  40.  
  41. fo≥ eacΦ valiΣ O╘ Entry
  42.   savσ objec⌠ heade≥ inf∩ in
  43.     O╘ entry
  44.   savσ O╨ iε objec⌠ header
  45. endfor
  46. Se⌠ allocatioε pointe≥ t∩ poin⌠ at
  47.     thσ star⌠ oµ thσ swa≡ area
  48. fo≥ eacΦ objec⌠ iε thσ swa≡ area
  49.     iµ valiΣ object
  50.     then
  51.       Movσ objec⌠ t∩ curren⌠                ì
  52.         allocatioε pointer
  53.       Restorσ objec⌠ header
  54.         froφ thσ O╘ usinτ saveΣ OP
  55.       Se⌠ O╘ addres≤ equa∞ to
  56.         allocatioε pointer
  57.       AdΣ sizσ oµ objec⌠ to
  58.         allocatioε pointer
  59.     else
  60.       Ski≡ thi≤ object
  61.     endif
  62. endfor
  63.